package com.loong.loong.hik.task;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.loong.loong.hik.entity.Snap;
import com.loong.loong.hik.service.SnapService;
import com.loong.loong.hik.util.HikUtil;
import com.xxl.job.core.handler.annotation.XxlJob;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 抓拍控制计划
 * @author jinyiang
 * @date 2023/4/17 10:25
 */
@Slf4j
@Component
public class SnapTask {

	@Resource
	private HikUtil hikUtil;
	@Resource
	private SnapService snapService;




	/**
	 * 抓拍控制计划：
	 *  扫描计划表，判断设备在抓拍计划范围内，每隔20s掉海康的抓拍接口，并将接口返回的人员信息存入相关表里
	 */
	@XxlJob("snap")
	public void snap(){
		Snap snap = new Snap();
		List<Snap> list = snapService.list(Wrappers.query(snap).lambda().le(Snap::getSnapStartTime, new Date()).ge(Snap::getSnapStartTime, new Date()));
		//回去看代码
		for (Snap snap1 : list) {
			//掉接口，存数据库

		}

	}

	public void deal(Snap snap){

	}
}
